package com.chen.recruit.controller;

import java.util.List;
import java.util.Arrays;

import com.chen.recruit.common.annotation.Log;
import com.chen.recruit.common.api.CommonResult;
import com.chen.recruit.common.enums.BusinessType;
import com.chen.recruit.common.valid.AddGroup;
import com.chen.recruit.common.valid.UpdateGroup;
import com.chen.recruit.domain.model.PageQuery;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.chen.recruit.domain.vo.ResumeVo;
import com.chen.recruit.service.ResumeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api( tags = "简历管理 ResumeController")
@RequiredArgsConstructor
@RestController
@RequestMapping("/recruit/resume")
public class ResumeController {

    private final ResumeService resumeService;

    @ApiOperation("新增简历")
    @SaCheckPermission("recruit:resume:add")
    @Log(module = "招聘管理-简历管理", businessType = BusinessType.INSERT)
    @PostMapping
    public CommonResult add(@Validated(AddGroup.class) @RequestBody ResumeVo bo) {
        return null;
    }

    @ApiOperation("删除简历")
    @SaCheckPermission("recruit:resume:delete")
    @Log(module = "招聘管理-简历管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{resumeIds}")
    public CommonResult delete(@NotEmpty(message = "简历id不能为空") @PathVariable Integer[] resumeIds) {
        return null;
    }

    @ApiOperation("修改简历")
    @SaCheckPermission("recruit:resume:update")
    @Log(module = "招聘管理-简历管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public CommonResult edit(@Validated(UpdateGroup.class) @RequestBody ResumeVo bo) {
        return null;
    }

    @ApiOperation("获取简历详细信息")
    @SaCheckPermission("recruit:resume:get")
    @GetMapping("/{resumeId}")
    public CommonResult getInfo(@NotNull(message = "主键不能为空") @PathVariable("resumeId") Integer resumeId) {
        return null;
    }

    @ApiOperation("查询简历列表")
    @SaCheckPermission("recruit:resume:list")
    @GetMapping("/list")
    public CommonResult list(ResumeVo bo, PageQuery pageQuery) {
        return null;
    }

    @ApiOperation("导出简历列表")
    @SaCheckPermission("recruit:resume:export")
    @Log(module = "招聘管理-简历管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response) {
//        List<ResumeVo> list = resumeService.queryList(bo);
//        ExcelUtil.exportExcel(list, "简历", ResumeVo.class, response);
    }

}
